const getters = {
  sidebar: state => state.app.sidebar,
  token: state => {
    if (state.user.token === '') {
      return window.localStorage.getItem('token')
    } else {
      return state.user.token
    }
  },
  avatar: state => {
    if (state.user.avatar === '') {
      return window.localStorage.getItem('avatar')
    } else {
      return state.user.avatar
    }
  },
  name: state => {
    if (state.user.name === '') {
      return window.localStorage.getItem('name')
    } else {
      return state.user.name
    }
  },
  roles: state => {
    if (state.user.roles === '') {
      return window.localStorage.getItem('roles')
    } else {
      return state.user.roles
    }
  },
  nickname: state => {
    if (state.user.nickname === '') {
      return window.localStorage.getItem('nickname')
    } else {
      return state.user.nickname
    }
  }
}
export default getters
